package org.test.code.thread.lock;

import java.util.concurrent.locks.Lock;
import java.util.concurrent.locks.ReentrantLock;

public class LockTestObject {

	private Lock lock = new ReentrantLock();
	private int count;
	private double value;
	
	public void addValue(double value){
		lock.lock();
		try{
		this.value += value;
		this.count ++;
		System.out.println("Adding the value for Thread: " + Thread.currentThread().getName());
		Thread.sleep(10000);
		}catch(Exception e){
			
		}finally{
			lock.unlock();
		}
	}
}
